import request from '@/utils/request'

// 查询用户信息列表
export function listYonghu(query) {
  return request({
    url: '/sxt/yonghu/list',
    method: 'get',
    params: query
  })
}

// 查询用户信息详细
export function getYonghu(userId) {
  return request({
    url: '/sxt/yonghu/' + userId,
    method: 'get'
  })
}

// 新增用户信息
export function addYonghu(data) {
  return request({
    url: '/sxt/yonghu',
    method: 'post',
    data: data
  })
}

// 修改用户信息
export function updateYonghu(data) {
  return request({
    url: '/sxt/yonghu',
    method: 'put',
    data: data
  })
}

// 删除用户信息
export function delYonghu(userId) {
  return request({
    url: '/sxt/yonghu/' + userId,
    method: 'delete'
  })
}

// 查询部门下拉树结构
export function bumenTreeSelect() {
  return request({
    url: '/sxt/yonghu/bumenTree',
    method: 'get'
  })
}
// 用户状态修改
export function changeYonghuStatus(userId, status) {
  const data = {
    userId,
    status
  }
  return request({
    url: '/sxt/yonghu/change_yonghu_status',
    method: 'post',
    data: data
  })
}
export function getAddInfo() {
  return request({
    url: '/sxt/yonghu/get_add_info',
    method: 'get',
 })
}
export function getUpdateInfo(userId) {
  return request({
    url: '/sxt/yonghu/get_update_info/'+userId+'',
    method: 'get',
 })
}
// 查询授权角色
export function getAuthRole(userId) {
  return request({
    url: '/sxt/yonghu/authRole/' + userId,
    method: 'get'
  })
}
// 保存授权角色
export function updateAuthRole(data) {
  return request({
    url: '/sxt/yonghu/authRoleSave',
    method: 'put',
    params: data
  })
}
// 用户密码重置
export function resetPwd(userId, password) {
  const data = {
    userId,
    password
  }
  return request({
    url: '/sxt/yonghu/resetPwd',
    method: 'put',
    data: data
  })
}
